package com.example.apptest.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.example.app_test.R;

public class ButtonView extends RelativeLayout {
    private TextView tvOn;
    private TextView tvOff;
    private void init(){
        LayoutInflater.from(getContext()).inflate(R.layout.btn_item, this);
        tvOn = findViewById(R.id.on);
        tvOff = findViewById(R.id.off);
    }

    public ButtonView(Context context){
        super(context);
        init();
    }

    public ButtonView(Context context, AttributeSet attrs) {
        super(context, attrs);
        init();
    }
    public  void setText(String txt){
        LayoutInflater.from(getContext());

    }
    public  void setChecked(boolean isChecked){
        if(isChecked){
            tvOff.setVisibility(GONE);
            tvOn.setVisibility(VISIBLE);
        } else{
            tvOn.setVisibility(GONE);
            tvOff.setVisibility(VISIBLE);
        }
    }
}
